Skip to contentSkip to conversation

Amlogic Meson pinctrl driver

PATCH In review Beniamino Galvani 3 participants 10 messages Jan 17, 2015 – Jan 30, 2015

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v4 cover Amlogic Meson pinctrl driver

Hi,

this series adds a pinctrl driver for Amlogic Meson, providing common code for all the SoCs of the family and configuration data specific for Meson8.

DT binding documentation for the driver has already been merged and is not included in the series. The first patch is for the pinctrl/devel tree, the others for Carlo's meson tree.

Thanks,
Beniamino

Changes since v3 [ https://lkml.org/lkml/2014/11/16/171 ]
- add 'static' to meson8 structs and arrays
- use ERR_CAST() to avoid sparse warning in meson_map_resource()
- declare group list as 'const char * const *'

Changes since v2 [ https://lkml.org/lkml/2014/10/14/423 ]
- move modifications to mach-meson Kconfig to a separate patch
- use regmap_mmio
- use generic gpio xlate function
- don't hardcode gpio base number
- use gpiochip_add_pin_range()
- add kerneldoc documentation
- use plain module_platform_driver() instead of postcore_initcall
- avoid unneeded copies of platform data

Changes since v1 [ https://lkml.org/lkml/2014/10/7/712 ]
- added missing checks of return values
- indentation fixes
- added missing definitions of groups and functions for Meson8

Beniamino Galvani (3):
pinctrl: add driver for Amlogic Meson SoCs
ARM: meson: select PINCTRL_MESON and ARCH_REQUIRE_GPIOLIB
ARM: dts: meson8: add pinctrl node

 arch/arm/boot/dts/meson8.dtsi          |   68 ++
 arch/arm/mach-meson/Kconfig            |    3 +
 drivers/pinctrl/Kconfig                |    8 +
 drivers/pinctrl/Makefile               |    1 +
 drivers/pinctrl/meson/Makefile         |    2 +
 drivers/pinctrl/meson/pinctrl-meson.c  |  761 ++++++++++++++++++++++
 drivers/pinctrl/meson/pinctrl-meson.h  |  209 ++++++
 drivers/pinctrl/meson/pinctrl-meson8.c | 1089 ++++++++++++++++++++++++++++++++
 include/dt-bindings/gpio/meson8-gpio.h |  157 +++++
 9 files changed, 2298 insertions(+)
 create mode 100644 drivers/pinctrl/meson/Makefile
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson8.c
 create mode 100644 include/dt-bindings/gpio/meson8-gpio.h
Signature · 1 line
2.1.4
#1 lore raw

PATCH v4 1/3 pinctrl: add driver for Amlogic Meson SoCs

This is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. It currently supports only Meson8, however the common code should be generic enough to work also for other SoCs after having defined the proper set of functions and groups.

GPIO interrupts are not supported at the moment due to lack of documentation.

---
 drivers/pinctrl/Kconfig                |    8 +
 drivers/pinctrl/Makefile               |    1 +
 drivers/pinctrl/meson/Makefile         |    2 +
 drivers/pinctrl/meson/pinctrl-meson.c  |  761 ++++++++++++++++++++++
 drivers/pinctrl/meson/pinctrl-meson.h  |  209 ++++++
 drivers/pinctrl/meson/pinctrl-meson8.c | 1089 ++++++++++++++++++++++++++++++++
 include/dt-bindings/gpio/meson8-gpio.h |  157 +++++
 7 files changed, 2227 insertions(+)
 create mode 100644 drivers/pinctrl/meson/Makefile
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson8.c
 create mode 100644 include/dt-bindings/gpio/meson8-gpio.h
drivers/pinctrl/Kconfig +8 -0
index e738cca..ee9f44a 100644
@@ -96,6 +96,14 @@ config PINCTRL_FALCON
 	depends on SOC_FALCON
 	depends on PINCTRL_LANTIQ
 
+config PINCTRL_MESON
+	bool
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select OF_GPIO
+	select REGMAP_MMIO
+
 config PINCTRL_ROCKCHIP
 	bool
 	select PINMUX
drivers/pinctrl/Makefile +1 -0
index 6c28bd6..0475206 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
 obj-$(CONFIG_PINCTRL_BCM2835)	+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM281XX)	+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_FALCON)	+= pinctrl-falcon.o
+obj-$(CONFIG_PINCTRL_MESON)	+= meson/
 obj-$(CONFIG_PINCTRL_PALMAS)	+= pinctrl-palmas.o
 obj-$(CONFIG_PINCTRL_ROCKCHIP)	+= pinctrl-rockchip.o
 obj-$(CONFIG_PINCTRL_SINGLE)	+= pinctrl-single.o
drivers/pinctrl/meson/Makefile new file +2 -0
new file mode 100644
index 0000000..eafc216
@@ -0,0 +1,2 @@
+obj-y	+= pinctrl-meson8.o
+obj-y	+= pinctrl-meson.o
drivers/pinctrl/meson/pinctrl-meson.c new file +761 -0

761 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson.h new file +209 -0

209 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson8.c new file +1089 -0

1,089 lines not on this page · raw message

include/dt-bindings/gpio/meson8-gpio.h new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Quoted 9 lines · Beniamino Galvani

This is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. It currently supports only Meson8, however the common code should be generic enough to work also for other SoCs after having defined the proper set of functions and groups.

GPIO interrupts are not supported at the moment due to lack of documentation.

Patch applied. Great work Beniamino!

Yours,
Linus Walleij

#3 lore raw

Re: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Hi linus,
How could I get these code?

48169172

From: Linus Walleij
Date: 2015-01-20 17:59
To: Beniamino Galvani
CC: Mark Rutland; [email protected]; Victor Wan; Russell King; Pawel Moll; Arnd Bergmann; Ian Campbell; [email protected]; [email protected]; Rob Herring; Soren Brinkmann; Kumar Gala; Carlo Caione; Jerry Cao; [email protected]
Subject: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Quoted 9 lines · Beniamino Galvani

This is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. It currently supports only Meson8, however the common code should be generic enough to work also for other SoCs after having defined the proper set of functions and groups.

GPIO interrupts are not supported at the moment due to lack of documentation.

Patch applied. Great work Beniamino!

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

Re: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Quoted 2 lines · On Thu, Jan 22, 2015 at 4:02 AM, 48169172 <[email protected]> wrote:

Hi linus,
How could I get these code?

git clone git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
git checkout devel

Yours,
Linus Walleij

#5 lore raw

Re: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Hi Linus,
I do not find the meson dir,
https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-pinctrl.git/tree/drivers/pinctrl?h=devel
Is there something wrong?

48169172

From: Linus Walleij
Date: 2015-01-22 16:37
To: 48169172
CC: Mark Rutland; [email protected]; Russell King; Victor Wan; Pawel Moll; Ian Campbell; linux-kernel; b.galvani; [email protected]; Rob Herring; Arnd Bergmann; [email protected]; Kumar Gala; [email protected]; Jerry Cao; Soren Brinkmann
Subject: Re: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Quoted 2 lines · On Thu, Jan 22, 2015 at 4:02 AM, 48169172 <[email protected]> wrote:

Hi linus,
How could I get these code?

git clone git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
git checkout devel

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

Re: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

In reply to Linus Walleij

Hi Linus,
I do not find the meson dir,
https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-pinctrl.git/tree/drivers/pinctrl?h=devel
Is there something wrong?

48169172

From: Linus Walleij
Date: 2015-01-22 16:37
To: 48169172
CC: Mark Rutland; [email protected]; Russell King; Victor Wan; Pawel Moll; Ian Campbell; linux-kernel; b.galvani; [email protected]; Rob Herring; Arnd Bergmann; [email protected]; Kumar Gala; [email protected]; Jerry Cao; Soren Brinkmann
Subject: Re: Re: [PATCH v4 1/3] pinctrl: add driver for Amlogic Meson SoCs

Quoted 2 lines · On Thu, Jan 22, 2015 at 4:02 AM, 48169172 <[email protected]> wrote:

Hi linus,
How could I get these code?

git clone git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
git checkout devel

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#8 lore raw

PATCH v4 2/3 ARM: meson: select PINCTRL_MESON and ARCH_REQUIRE_GPIOLIB

In reply to Beniamino Galvani

Make sure that the Meson pinctrl driver is built whenever Meson support is enabled.

---
 arch/arm/mach-meson/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-meson/Kconfig +3 -0
index 18301dc..0743e20 100644
@@ -1,8 +1,11 @@
 menuconfig ARCH_MESON
 	bool "Amlogic Meson SoCs" if ARCH_MULTI_V7
+	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_IRQ_CHIP
 	select ARM_GIC
 	select CACHE_L2X0
+	select PINCTRL
+	select PINCTRL_MESON
 
 if ARCH_MESON
 
Signature · 1 line
2.1.4
#9 lore raw

PATCH v4 3/3 ARM: dts: meson8: add pinctrl node

In reply to Beniamino Galvani

Add pinctrl node to the DTSI file for meson8 and sub-nodes for some standard mux configurations.

---
 arch/arm/boot/dts/meson8.dtsi | 68 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
arch/arm/boot/dts/meson8.dtsi +68 -0
index 1f442a7..a2ddcb8 100644
@@ -43,6 +43,7 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include <dt-bindings/gpio/meson8-gpio.h>
 /include/ "meson.dtsi"
 
 / {
@@ -89,4 +90,71 @@
 		compatible = "fixed-clock";
 		clock-frequency = <141666666>;
 	};
+
+	pinctrl: pinctrl at c1109880 {
+		compatible = "amlogic,meson8-pinctrl";
+		reg = <0xc1109880 0x10>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		gpio: banks at c11080b0 {
+			reg = <0xc11080b0 0x28>,
+			      <0xc11080e8 0x18>,
+			      <0xc1108120 0x18>,
+			      <0xc1108030 0x30>;
+			reg-names = "mux", "pull", "pull-enable", "gpio";
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+
+		gpio_ao: ao-bank at c1108030 {
+			reg = <0xc8100014 0x4>,
+			      <0xc810002c 0x4>,
+			      <0xc8100024 0x8>;
+			reg-names = "mux", "pull", "gpio";
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+
+		uart_ao_a_pins: uart_ao_a {
+			mux {
+				groups = "uart_tx_ao_a", "uart_rx_ao_a";
+				function = "uart_ao";
+			};
+		};
+
+		i2c_ao_pins: i2c_mst_ao {
+			mux {
+				groups = "i2c_mst_sck_ao", "i2c_mst_sda_ao";
+				function = "i2c_mst_ao";
+			};
+		};
+
+		spi_nor_pins: nor {
+			mux {
+				groups = "nor_d", "nor_q", "nor_c", "nor_cs";
+				function = "nor";
+			};
+		};
+
+		ir_recv_pins: remote {
+			mux {
+				groups = "remote_input";
+				function = "remote";
+			};
+		};
+
+		eth_pins: ethernet {
+			mux {
+				groups = "eth_tx_clk_50m", "eth_tx_en",
+					 "eth_txd1", "eth_txd0",
+					 "eth_rx_clk_in", "eth_rx_dv",
+					 "eth_rxd1", "eth_rxd0", "eth_mdio",
+					 "eth_mdc";
+				function = "ethernet";
+			};
+		};
+	};
+
 }; /* end of / */
Signature · 1 line
2.1.4